//
//  ICChatSystemTopCell.m
//  ICome
//
//  Created by zhangrongwu on 2017/9/6.
//  Copyright © 2017年 iCom. All rights reserved.
//

#import "ICChatSystemTopCell.h"
#import "ICSysTopButton.h"
#import "ICMessageModel.h"

@interface ICChatSystemTopCell ()
@property (nonatomic, strong) ICSysTopButton *button;

@end
@implementation ICChatSystemTopCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self.contentView addSubview:self.button];
    }
    return self;
}



- (void)setModelFrame:(ICMessageFrame *)modelFrame
{
    [super setModelFrame:modelFrame];
    
    self.button.frame = modelFrame.picViewF;
    self.button.messageModel = modelFrame.model;
}

#pragma mark - Event

- (void)shareBtnClicked
{
    [self routerEventWithName:GXRouterEventSysTopEvent
                     userInfo:@{MessageKey : self.modelFrame,
                                }];
}

#pragma mark - Getter

- (ICSysTopButton *)button
{
    if (!_button) {
        _button = [ICSysTopButton buttonWithType:UIButtonTypeCustom];
        [_button addTarget:self action:@selector(shareBtnClicked) forControlEvents:UIControlEventTouchUpInside];
    }
    return _button;
}





@end
